<template>
  <div>
    <box-border style="padding: 20px;border-radius: 3px;">
      <span style="font-size: 17px;font-weight: bold">新建督办</span>
    </box-border>
    <box-border style="padding: 10px;border-radius: 3px;margin-top: 1px;">
      <el-row style="margin-left: 150px">
        <el-col :span="12" v-loading="loading">
          <supervise-add
            @saveData="saveSupervise"
            ref="superviseAdd"
          ></supervise-add>
        </el-col>
      </el-row>
    </box-border>
  </div>
</template>

<script>
  import superviseAdd from "./superviseAdd";

  export default {
    name: "superviseDetail",
    components: {
      superviseAdd
    },
    data() {
      return {
        loading: false
      };
    },
    mounted() {
    },
    activated() {
      if (this.$route.params.canRefresh) {
        this.initData();
      }
    },
    methods: {
      initData() {
        this.$nextTick(vm => {
          this.$refs.superviseAdd.initData();
        });
      },
      // 保存督办信息
      saveSupervise(data) {
        this.loading = true;
        this.API.addOrUpdateSupervisionMatter({body: data})
          .then(() => {
            this.success("提交成功");
          })
          .catch(() => {
          })
          .finally(() => {
            this.loading = false;
          });
      }
    }
  };
</script>

<style scoped></style>
